package model

import (
	"gorm.io/gorm"
)

type Order struct {
	gorm.Model
	OrderSn    string         `gorm:"type:varchar(100);not null;comment:订单编号" json:"OrderSn"`
	TotalPrice float32        `gorm:"type:decimal(8,2);not null;comment:商品单价" json:"ShopPrice"`
	Status     int            `gorm:"type:tinyint(1);check:status IN (0,1);default:1;not null;comment:商品名称" json:"Status"`
	Goods      []*OrderDetail `gorm:"foreignKey:OrderSn;references:OrderSn"`
}

type OrderDetail struct {
	gorm.Model
	OrderSn  string `gorm:"type:varchar(100);not null;comment:订单编号" json:"OrderSn"`
	GoodsId  int
	GoodsNum int
}
